<?php

if (load(dirname(__FILE__), 'local.ini')) {
    $localSettings = parse_ini_file(dirname(__FILE__).'/local.ini');
}
if (load($_SERVER['DOCUMENT_ROOT'].'/../tpl/'.$localSettings['lang'], 'lang.php')) {
    require_once $_SERVER['DOCUMENT_ROOT'].'/../tpl/'.$localSettings['lang'].'/lang.php';
}
if (load($localSettings['es_dir'], 'global.core.php')) {
    require_once $localSettings['es_dir'].'/global.core.php';
}

function load($dir, $file)
{
    if (file_exists($dir)) {
        if (file_exists($dir.'/'.$file)) {
            return true;
        } else {
            alert('The file named <b>'.$file.'</b> does not exist in the directory <b>'.$dir.'</b>');
        }
    } else {
        alert('The directory named <b>'.$dir.'</b> does not exist');
    }
}

function alert($message)
{
    echo $message;
    die();
}

?>
